package Model.Beans.Results;

import Model.Beans.*;
import Model.XML.*;
import java.util.*;

public class PersonList {
    
    private ArrayList persons;
    private XMLWriter xml;
    
    public PersonList() 
    {
        persons = new ArrayList();
        xml = new XMLWriter();
    }
    
    public void addPerson(Person person)
    {
        persons.add(person);
    }
    
    public ArrayList getPersons()
    {
        return persons;
    }
            
    public String toXML()
    {
        xml.Push("person-list");
        for(int i=0; i<persons.size(); i++)
        {
            Person tmp = (Person)persons.get(i);
            xml.Element("person", tmp.toString(), Integer.toString(tmp.getId()));
        }
        xml.Pop();
        return xml.GetXML();
    }
}
